﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="NewRequest.aspx.cs" Inherits="OtherCaptitalReim.NewRequest" %>

<%@ Register Src="../../Processes/ProcessControl/UserInfo_TY.ascx" TagName="UserInfo"
    TagPrefix="ui" %>
<%@ Register Src="../../Processes/ProcessControl/ApprovalHistory_TY.ascx" TagName="ApprovalHistory"
    TagPrefix="ah" %>
<%@ Register Src="../../Processes/ProcessControl/Attachments_TY.ascx" TagName="Attachments"
    TagPrefix="attach" %>
<%@ Register Src="../../Processes/ProcessControl/ButtonList_TY.ascx" TagName="ButtonList"
    TagPrefix="btn" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>其他资金支付及发票报销申请</title>
    <script src="../../js/jquery.js" type="text/javascript"></script>
    <script type="text/javascript" src="../../js/My97DatePicker/WdatePicker.js"></script>
    <script type="text/javascript" src="../../js/common.js"></script>
    <script type="text/javascript" language="javascript">

        //删除当前行
        function deletetS(rows) {

            $(rows).parent().parent().find("[id*=fld_TSUPPLIERNAME]").attr("class", ".");
            $(rows).parent().parent().find("[id*=fld_TCONTENTS]").attr("class", ".");
            $(rows).parent().parent().find("[id*=fld_TCONTRACTNO]").attr("class", ".");
            $(rows).parent().parent().find("[id*=fld_TCONTRACTPRICE]").attr("class", ".");
            $(rows).parent().parent().find("[id*=fld_TSUPPLYDATA]").attr("class", ".");
            $(rows).parent().parent().find("[id*=fld_TCONTRACTDATA]").attr("class", ".");
            $(rows).parent().parent().find("[id*=fld_TPAYMENTPRICE]").attr("class", ".");
            $(rows).parent().parent().find("[id*=fld_TTHISNEEDPRICE]").attr("class", ".");
            $(rows).parent().parent().find("[id*=fld_TADVANCEDATE]").attr("class", ".");

        }

        function check(ID) {
            if (ID == 'rdoMoney') {
                document.getElementById("DivContract").style.display = "none";
                document.getElementById("mytable").style.display = "";
                document.getElementById("mytable1").style.display = "";
                $("#fld_TTABLETYPE").val("合同付款审批");

            } else if (ID == 'rdoRemiber') {

                document.getElementById("mytable").style.display = "none";
                document.getElementById("mytable1").style.display = "none";
                document.getElementById("DivContract").style.display = "";
                $("#fld_TTABLETYPE").val("合同发票报销审批");
            }
        }
        $(document).ready(function () {
            if ($("#fld_TTABLETYPE").val() == "合同发票报销审批") {
                document.getElementById("mytable").style.display = "none";
                document.getElementById("mytable1").style.display = "none";
                document.getElementById("DivContract").style.display = "block";
                $("#txtfpje").val($("#fld_TFPJE").val());
                $("#lbfpjedx").text($("#fld_TJEDX").val());
                document.getElementById("rdoRemibur").checked = "checked";
            }
            else {
                $("#fld_TTABLETYPE").val("合同付款审批");
                //document.getElementById("mytable").style.display = "";
                document.getElementById("DivContract").style.display = "none";
                changeFKPrice();
            }

            if (request("Type") == "myrequest") {
                $("#rbtype").css("display", "none");
                $("#divType").css("display", "block");
            }
        });
        function changeJEDX() {
            var je = $("#txtfpje").val();
            if (isNaN(je)) {
                $("#txtfpje").val("");
                $("#lbfpjedx").text("");
            }
            else {
                $("#lbfpjedx").text(ChangeRMBToCH(je));
                $("#fld_TFPJE").val(je);
                $("#fld_TJEDX").val(ChangeRMBToCH(je));
            }
        }
        function changeFKPrice() {
            var sum = 0;
            var msg = "";
            $("#mytable").find("tr:gt(0)").each(function (i, Etr) {
                var JE = $(Etr).find("td").eq(7).find("input").val() - 0;
                if (!isNaN(JE)) {
                    sum += JE;
                }
                else {
                    $(Etr).find("td").eq(7).find("input").val("");
                }
            });

            $("#lbje").text(sum);
            $("#lbjedx").text(ChangeRMBToCH(sum.toString()));
            $("#fld_TFPJE").val(sum);
            $("#fld_TJEDX").val(ChangeRMBToCH(sum.toString()));

            //alert($("#fld_TFPJE").val());
        }
    </script>
    <script type="text/javascript" language="javascript">
        window.onload = function () {
            document.getElementById("fld_YHKH").onkeyup = function () {
                this.value = this.value.replace(/\s/g, '').replace(/(\d{4})(?=\d)/g, "$1 "); ;
            };
        }; </script>
</head>
<body>
    <form id="form1" runat="server">
    <div class="container">
        <div class="row">
            <ui:userinfo id="UserInfo1" processtitle="其他资金支付及发票报销申请" tablename="PROC_OTHERCAPTITA"
                processprefix="OTCR" tablenamedetail="PROC_OTHERCAPTITA_DETAIL" runat="server"></ui:userinfo>
        </div>
        <div class="row">
            <table class="table table-condensed table-bordered">
                <tr>
                    <td class="banner" width="17%">
                        表单类别<span class="red">*</span>
                    </td>
                    <td class="td-content">
                        <div id="rbtype">
                            <span onclick="check('rdoMoney')">
                                <asp:RadioButton ID="rdoMoney" runat="server" Checked="true" GroupName="rdos" Text="合同付款审批" /></span>
                            <span onclick="check('rdoRemiber')">
                                <asp:RadioButton ID="rdoRemibur" runat="server" GroupName="rdos" Text="合同发票报销审批" /></span>
                        </div>
                        <div id="divType" style="display: none">
                            <asp:TextBox runat="server" ID="fld_TTABLETYPE"></asp:TextBox>
                        </div>
                    </td>
                </tr>
            </table>
            <table id="mytable1" class="table table-condensed table-bordered">
                <tr>
                    <td class="banner" width="17%">
                        合同付款类
                    </td>
                    <td colspan="9">
                    </td>
                </tr>
                <tr>
                    <td class="td-label">
                        是否在预算内：<span class="red">*</span>
                    </td>
                    <td class="td-content" colspan="3">
                        <asp:DropDownList ID="fld_TISYS" runat="server" CssClass="validate[required]">
                            <asp:ListItem Value="">--请选择--</asp:ListItem>
                            <asp:ListItem Value="是">是</asp:ListItem>
                            <asp:ListItem Value="否">否</asp:ListItem>
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td class="td-label">
                        付款金额：<span class="red">*</span>
                    </td>
                    <td class="td-content">
                        <asp:Label ID="lbje" runat="server" Text=""></asp:Label>
                        <div style="display: none">
                            <asp:TextBox runat="server" ID="fld_TFPJE"></asp:TextBox>
                        </div>
                    </td>
                    <td class="td-label">
                        付款金额大写：
                    </td>
                    <td class="td-content">
                        <asp:Label ID="lbjedx" runat="server" Text=""></asp:Label>
                        <div style="display: none">
                            <asp:TextBox runat="server" ID="fld_TJEDX"></asp:TextBox>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td class="td-label">
                        开户行：<span class="red">*</span>
                    </td>
                    <td class="td-content">
                        <asp:TextBox ID="fld_KHH" runat="server" class="validate[required]"></asp:TextBox>
                    </td>
                    <td class="td-label">
                        银行卡号：<span class="red">*</span>
                    </td>
                    <td class="td-content">
                        <asp:TextBox ID="fld_YHKH" runat="server" class="validate[required]"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td class="td-label">
                        支付种类:<span class="red">*</span>
                    </td>
                    <td class="td-content" colspan="3">
                        <asp:DropDownList ID="fld_PAYTYPE" runat="server" CssClass="validate[required]">
                            <asp:ListItem Value="">--请选择--</asp:ListItem>
                            <asp:ListItem Value="实验性设备类">实验性设备类</asp:ListItem>
                            <asp:ListItem Value="公司级办公用品类">公司级办公用品类</asp:ListItem>
                            <asp:ListItem Value="其它类">其它类</asp:ListItem>
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td class="td-label">
                        付款信息：
                    </td>
                    <td class="td-content" colspan="3">
                        <asp:TextBox runat="server" ID="fld_TFKINFO" TextMode="MultiLine" Width="98%" Height="60px"></asp:TextBox>
                    </td>
                </tr>
            </table>
            <table id="mytable" class="table table-condensed table-bordered tablerequired">
                <tr>
                    <th>
                        供应商名称
                    </th>
                    <th>
                        内容
                    </th>
                    <th>
                        合同编号
                    </th>
                    <th>
                        合同金额
                    </th>
                    <th>
                        供货数量
                    </th>
                    <th>
                        合同数量
                    </th>
                    <th>
                        已付金额
                    </th>
                    <th>
                        本次所需要金额
                    </th>
                    <th>
                        预计付款时间
                    </th>
                    <th>
                        <asp:Button ID="Button1" runat="server" Text="增加" CssClass="btn" OnClick="Button1_Click" />
                    </th>
                </tr>
                <asp:Repeater runat="server" ID="fld_detail_PROC_OTHERCAPTITA_DETAIL" OnItemCommand="fld_PROC_OTHERCAPTITA_PROC_OTHERCAPTITA_DETAIL_ItemCommand">
                    <ItemTemplate>
                        <tr>
                            <td class="td-content">
                                <asp:TextBox ID="fld_FORMID" Text='<%#Eval("FORMID") %>' runat="server" Style="display: none"></asp:TextBox>
                                <asp:TextBox ID="fld_TSUPPLIERNAME" runat="server" Width="90%" CssClass="validate[required]"
                                    Text='<%#Eval("TSUPPLIERNAME") %>'></asp:TextBox>
                            </td>
                            <td class="td-content">
                                <asp:TextBox ID="fld_TCONTENTS" runat="server" Width="80%" CssClass="validate[required]"
                                    Text='<%#Eval("TCONTENTS") %>'></asp:TextBox>
                            </td>
                            <td class="td-content">
                                <asp:TextBox ID="fld_TCONTRACTNO" runat="server" Width="90%" Text='<%#Eval("TCONTRACTNO") %>'
                                    CssClass="validate[required]"></asp:TextBox>
                            </td>
                            <td class="td-content">
                                <asp:TextBox ID="fld_TCONTRACTPRICE" runat="server" Width="90%" money="money" class="validate[required]"
                                    Text='<%#Eval("TCONTRACTPRICE") %>'></asp:TextBox>
                            </td>
                            <td class="td-content">
                                <asp:TextBox ID="fld_TSUPPLYDATA" runat="server" Width="85%" money="money" class="validate[required]"
                                    Text='<%#Eval("TSUPPLYDATA") %>'></asp:TextBox>
                            </td>
                            <td class="td-content">
                                <asp:TextBox ID="fld_TCONTRACTDATA" runat="server" Width="90%" money="money" Text='<%#Eval("TCONTRACTDATA") %>'
                                    class="validate[required]"></asp:TextBox>
                            </td>
                            <td class="td-content">
                                <asp:TextBox ID="fld_TPAYMENTPRICE" money="money" onkeyup="changeFKPrice()" runat="server"
                                    Width="90%" Text='<%#Eval("TPAYMENTPRICE") %>' class="validate[required]"></asp:TextBox>
                            </td>
                            <td class="td-content" width="14%">
                                <asp:TextBox ID="fld_TTHISNEEDPRICE" money="money" onblur="changeFKPrice()" runat="server"
                                    Width="90%" Text='<%#Eval("TTHISNEEDPRICE") %>' class="validate[required]"></asp:TextBox>
                            </td>
                            <td class="td-content">
                                <asp:TextBox ID="fld_TADVANCEDATE" runat="server" Width="90%" OnClick="WdatePicker({dateFmt:'yyyy-MM-dd'})"
                                    CssClass="validate[required] Wdate" Text='<%#Eval("TADVANCEDATE") %>'></asp:TextBox>
                            </td>
                            <td style="background-color: #f5f5f5;" align="center" width="6%">
                                <asp:Button ID="btnDelete" runat="server" Text="删除" CssClass="btn" CommandName="del"
                                    ClientIDMode="Static" OnClientClick="deletetS(this);return confirm('确认删除？')" />
                            </td>
                        </tr>
                    </ItemTemplate>
                </asp:Repeater>
            </table>
            <table id="DivContract" style="display: block;" class="table table-condensed table-bordered">
                <tr>
                    <td class="banner" colspan="4">
                        发票报销类
                    </td>
                </tr>
                <tr>
                    <td class="td-label">
                        所属公司：<span class="red">*</span>
                    </td>
                    <td class="td-content" colspan="3">
                        <asp:TextBox ID="fld_TSSGS" runat="server" CssClass="validate[required]"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td class="td-label">
                        发票金额：<span class="red">*</span>
                    </td>
                    <td class="td-content">
                        <asp:TextBox ID="txtfpje" runat="server" Text="" onblur="changeJEDX()" onkeyup="changeJEDX()"
                            class="validate[required]"></asp:TextBox>
                    </td>
                    <td class="td-label">
                        发票金额大写：
                    </td>
                    <td class="td-content">
                        <asp:Label ID="lbfpjedx" runat="server" Text=""></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td class="td-label">
                        发票号：<span class="red">*</span>
                    </td>
                    <td class="td-content" colspan="3">
                        <asp:TextBox ID="fld_TINVOCIENO" runat="server" CssClass="validate[required]"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td class="td-label">
                        发票信息：<span class="red">*</span>
                    </td>
                    <td class="td-content" colspan="3">
                        <asp:TextBox ID="fld_TINVOICEINFO" Width="98%" Height="60px" runat="server" CssClass="validate[required]"></asp:TextBox>
                    </td>
                </tr>
            </table>
        </div>
        <div class="row">
            <attach:attachments id="Attachments1" runat="server"></attach:attachments>
        </div>
        <div class="row">
            <ah:approvalhistory id="ApprovalHistory1" runat="server" showaction="false"></ah:approvalhistory>
        </div>
        <div class="row">
        </div>
    </div>
    <btn:buttonlist id="ButtonList1" runat="server"></btn:buttonlist>
    <div style="display: none;">
    </div>
    </form>
</body>
</html>
